<template>
    <div class="wrap">
        <img class="c-bg" src="@/assets/x1/index_bg.jpg" alt="" />
        <transition mode="out-in">
            <!-- <keep-alive :include="cachedViews"> -->
                <router-view />
            <!-- </keep-alive> -->
        </transition>
    </div>
</template>
<script>
  export default {
   data(){
       return{
           status:true
       }
   },
    watch:{
        '$route':{
            handler:function(to,from) {
                this.$Message.destroy()
                if(sessionStorage.getItem('urlNav') == null) return
                let name = to.name
                let array = sessionStorage.getItem('urlNav').split(',');

                switch(name){
                    case 'country':
                        if(array.length > 1){
                            array.pop();
                        }
                        break;
                    case 'province':
                        if(array.length > 2){
                            array.pop();
                        }

                        break;
                    case 'city':
                        if(array.length > 3){
                            array.pop();
                        }
                        break;
                }
                //判断是否直辖市
                if(array.length == 0) return
                let domainArray = ['北京市','上海市','重庆市','天津市']
                if(domainArray.includes(array[1])){
                    this.$store.dispatch("app/setDomain",true);
                }else{
                    this.$store.dispatch("app/setDomain",false);
                }
                sessionStorage.setItem('urlNav',array);
            },
            immediate:true
        }
    }
  }
</script>
<style scoped lang="scss">
.wrap{
    width: 100%;
    height: 100%;
}
  .c-bg{
    position: fixed;
    width: 100%;
    height: 100%;
    top:0;
    left: 0;
    z-index: -1;
  }
</style>